/*
 * Copyright (c) 2012-2014, EpicSaaS Yuan Xin technology Co., Ltd.
 * 
 * All rights reserved.
 */
package com.epicsaas.app.ksdapp.android.bean;

import java.math.BigDecimal;

/**
 * @author ghg
 *  购物车项
 */
public class CartItem {

    /** 购物项 id*/
    private long id;

    /** 是否被勾选 */
    private boolean chosen;

    /** 商品数量 */
    private int quantity;

    /** 应付金额 */
    private float itemPayPrice;

    /** 原价 */
    private float itemOldPrice;

    /** 商品总重量，单位：克 */
    private int itemWeight;

    /** 套餐 */
    private CartItemBundle cartItemBundle;

    /** 单个商品  */
    private Product item;

    /** 是否在有效期中 */
    private boolean isValid;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.user_id
     *
     * @mbggenerated
     */
    private Integer userId;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.shop_item_id
     *
     * @mbggenerated
     */
    private Integer shopItemId;

    ;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.status
     *
     * @mbggenerated
     */
    private Integer status;

    private Integer chosenItem = 0;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.shop_id
     *
     * @mbggenerated
     */
    private Integer shopId;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.gross_rate
     *
     * @mbggenerated
     */
    private Integer grossRate;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.discount
     *
     * @mbggenerated
     */
    private BigDecimal discount;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.is_boli
     *
     * @mbggenerated
     */
    private Byte isBoli;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.is_best
     *
     * @mbggenerated
     */
    private Byte isBest;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.check_first
     *
     * @mbggenerated
     */
    private Byte checkFirst;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column view_crat_item.stock
     *
     * @mbggenerated
     */
    private Integer stock;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public boolean isChosen() {
        if (getChosenItem() != 1) {
            chosen = false;
        }
        return chosen;
    }

    public void setChosen(boolean chosen) {
        this.chosen = chosen;
        if (getChosenItem() == 1 && !chosen) {
            setChosenItem(0);
        }
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public float getItemPayPrice() {
        return itemPayPrice;
    }

    public void setItemPayPrice(float itemPayPrice) {
        this.itemPayPrice = itemPayPrice;
    }

    public float getItemOldPrice() {
        return itemOldPrice;
    }

    public void setItemOldPrice(float itemOldPrice) {
        this.itemOldPrice = itemOldPrice;
    }

    public int getItemWeight() {
        return itemWeight;
    }

    public void setItemWeight(int itemWeight) {
        this.itemWeight = itemWeight;
    }

    public CartItemBundle getCartItemBundle() {
        return cartItemBundle;
    }

    public void setCartItemBundle(CartItemBundle cartItemBundle) {
        this.cartItemBundle = cartItemBundle;
    }

    public Product getItem() {
        return item;
    }

    public void setItem(Product item) {
        this.item = item;
    }

    public boolean isValid() {
        return isValid;
    }

    public void setValid(boolean isValid) {
        this.isValid = isValid;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getShopItemId() {
        return shopItemId;
    }

    public void setShopItemId(Integer shopItemId) {
        this.shopItemId = shopItemId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getShopId() {
        return shopId;
    }

    public void setShopId(Integer shopId) {
        this.shopId = shopId;
    }

    public Integer getGrossRate() {
        return grossRate;
    }

    public void setGrossRate(Integer grossRate) {
        this.grossRate = grossRate;
    }

    public BigDecimal getDiscount() {
        return discount;
    }

    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    public Byte getIsBoli() {
        return isBoli;
    }

    public void setIsBoli(Byte isBoli) {
        this.isBoli = isBoli;
    }

    public Byte getIsBest() {
        return isBest;
    }

    public void setIsBest(Byte isBest) {
        this.isBest = isBest;
    }

    public Byte getCheckFirst() {
        return checkFirst;
    }

    public void setCheckFirst(Byte checkFirst) {
        this.checkFirst = checkFirst;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public Integer getChosenItem() {
        return chosenItem;
    }

    public void setChosenItem(Integer chosenItem) {
        this.chosenItem = chosenItem;
    }
}
